package com.skwen.ssm.controller;

import com.skwen.ssm.po.Item;
import com.skwen.ssm.po.Student;
import com.skwen.ssm.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


@Controller
public class JsonController {


//    @Resource(name = "StudentService")
//    private StudentService studentService;


    @ResponseBody
    @RequestMapping(value = "/getItems", method = {RequestMethod.GET})
    public List<Item> getItems() throws Exception {
        Item item1 = new Item("skwen", "88098080");
        Item item2 = new Item("sjfskljfls", "8098908");
        List<Item> list = new ArrayList<Item>();
        list.add(item1);
        list.add(item2);
        return list;
    }

//
//    @ResponseBody
//    @RequestMapping(value = "/getListStudent", method = {RequestMethod.GET})
//    public HashMap getListStudent() throws Exception {
//        List<Student> list = studentService.getListStudent();
//        HashMap<String, Object> hashMap = new HashMap<String, Object>();
//        hashMap.put("listStudent", list);
//        return hashMap;
//    }


}
